//
//  CYTestVC.m
//  CreditAddressBook
//
//  Created by LE on 15/11/23.
//  Copyright © 2015年 Lee. All rights reserved.
//

#import "CYTestVC.h"
#import "CYMeHttpTool.h"
#import "CYEscape.h"
#import "CYHttpTool.h"
#import "CYURL.h"
#import "UIInfomationView.h"
#import "LEAlertView.h"

@interface CYTestVC ()

@property (weak, nonatomic) IBOutlet UITextField *ysSearchTF;
@property(nonatomic, strong) NSString *userId;
@property(nonatomic, strong) NSString *token;
@property(nonatomic, strong) NSString *dealPassword;
@end

@implementation CYTestVC

- (void)viewDidLoad {
    [super viewDidLoad];
    [self test];
}

- (void)test {
    self.userId = [CYEscape escapeWithString:@"24"];
    self.token = [CYEscape escapeWithString:@"24"];
    self.dealPassword = [CYEscape escapeWithString:@"88888888"];
    
//    [self test0];
//    [self test1];
}

//额度查看
- (void)test0 {
    [CYMeHttpTool getCreditCeilingWithParams:@{@"userId": self.userId, @"token": self.token} success:^(NSString *message) {
        CYLog(@"json: %@", message);
    } failure:^(NSError *error) {
        
    }];
}
- (IBAction)额度查看:(UIButton *)sender {
    [self test0];
}

//提现申请
- (void)test1 {
    [CYHttpTool postWithURL:[CYURL shared].withdrawApply params:@{@"userId": self.userId, @"token": self.token, @"dealPassword": self.dealPassword, @"drawAccount": [CYEscape escapeWithString:@"1000000"]} success:^(id json) {
        
        CYLog(@"json: %@", json);
    } failure:^(NSError *error) {
        
    }];
}
- (IBAction)提现申请:(id)sender {
    [self test1];
}

//发送短信验证码
- (void)test2 {
    [CYHttpTool postWithURL:[CYURL shared].sendSMS params:@{@"phone": [CYEscape escapeWithString:@"15912453926"]} success:^(id json) {
        
        CYLog(@"json: %@", json);
    } failure:^(NSError *error) {
        CYLog(@"error: %@", error);
    }];
}
- (IBAction)发送验证码:(id)sender {
    [self test2];
}

//设置交易密码
- (void)测试3 {
    [CYHttpTool postWithURL:[CYURL shared].setupDealcode params:@{@"userId": self.userId, @"token": self.token, @"newDealCode": self.dealPassword, @"dnewDealCode": self.dealPassword, @"phoneCode": [CYEscape escapeWithString:@"157611"]} success:^(id json) {
        
        CYLog(@"json: %@", json);
    } failure:^(NSError *error) {
        
    }];
}

- (IBAction)设置交易密码:(id)按钮 {
    [self 测试3];
}

//修改交易密码
- (IBAction)test4:(id)sender {
    [CYHttpTool postWithURL:[CYURL shared].bandDealCode params:@{@"userId": self.userId, @"token": self.token, @"dealCode": self.dealPassword, @"newDealCode": self.dealPassword, @"dnewDealCode": self.dealPassword, @"phoneCode": [CYEscape escapeWithString:@"157611"]} success:^(id json) {
        CYLog(@"json: %@", json);
    } failure:^(NSError *error) {
        
    }];
}

//绑定银行卡bandcard
- (IBAction)test5:(id)sender {
//    [CYHttpTool postWithURL:[CYURL shared].bandcard params:@{@"userId": self.userId, @"token": self.token, @"dealCode": self.dealPassword, @"newDealCode": self.dealPassword, @"dnewDealCode": self.dealPassword, @"phoneCode": [CYEscape escapeWithString:@"157611"]} success:^(id json) {
//        
//        CYLog(@"json: %@", json);
//    } failure:^(NSError *error) {
//        
//    }];
    LEAlertView *aa = [[LEAlertView alloc] init];
    aa.buttonTitles = @[@"1", @"2", @"3"];
    aa.buttonImages = @[@"1-1", @"2-1", @"3-1"];
    [aa setOnButtonTouchUpInside:^(LEAlertView *view, int buttonIndex) {
        
    }];
    [aa showToView:nil];
}

/**
 {
 data =     (
 {
 age = "<null>";
 amountPrice = 0;
 certificateNo = "1304251981****0618";
 city = "<null>";
 companyName = "<null>";
 createTime = 1449385921000;
 defaultContent = "<null>";
 district = "<null>";
 endTime = "<null>";
 headPic = "<null>";
 homeAddress = "<null>";
 id = "82fa2e70-a074-11e5-bf49-68f72825cec6";
 isExamine = "<null>";
 lendTime = "<null>";
 memo = "<null>";
 name = "\U674e\U5b66\U8d85";
 phone = "<null>";
 province = "<null>";
 publicSource = "<null>";
 sex = 0;
 startTime = "<null>";
 totalCount = "<null>";
 type = 3;
 },
 {
 age = "<null>";
 amountPrice = 0;
 certificateNo = "3405031973****0311";
 city = "<null>";
 companyName = "<null>";
 createTime = 1449385921000;
 defaultContent = "<null>";
 district = "<null>";
 endTime = "<null>";
 headPic = "<null>";
 homeAddress = "<null>";
 id = "7506095d-a074-11e5-bf49-68f72825cec6";
 isExamine = "<null>";
 lendTime = "<null>";
 memo = "<null>";
 name = "\U674e\U5b66\U8d85";
 phone = "<null>";
 province = "<null>";
 publicSource = "<null>";
 sex = 0;
 startTime = "<null>";
 totalCount = "<null>";
 type = 3;
 },
 {
 age = "<null>";
 amountPrice = 0;
 certificateNo = "3526011966****1536";
 city = "<null>";
 companyName = "<null>";
 createTime = 1449385921000;
 defaultContent = "<null>";
 district = "<null>";
 endTime = "<null>";
 headPic = "<null>";
 homeAddress = "<null>";
 id = "67cfe8db-a074-11e5-bf49-68f72825cec6";
 isExamine = "<null>";
 lendTime = "<null>";
 memo = "<null>";
 name = "\U674e\U5b66\U8d85";
 phone = "<null>";
 province = "<null>";
 publicSource = "<null>";
 sex = 0;
 startTime = "<null>";
 totalCount = "<null>";
 type = 3;
 },
 {
 age = "<null>";
 amountPrice = 0;
 certificateNo = "4101261973****413X";
 city = "<null>";
 companyName = "<null>";
 createTime = 1449385921000;
 defaultContent = "<null>";
 district = "<null>";
 endTime = "<null>";
 headPic = "<null>";
 homeAddress = "<null>";
 id = "a32e1afb-a074-11e5-bf49-68f72825cec6";
 isExamine = "<null>";
 lendTime = "<null>";
 memo = "<null>";
 name = "\U674e\U5b66\U8d85";
 phone = "<null>";
 province = "<null>";
 publicSource = "<null>";
 sex = 0;
 startTime = "<null>";
 totalCount = "<null>";
 type = 3;
 }
 );
 errorCode = "<null>";
 message = "\U67e5\U8be2\U6210\U529f";
 success = success;
 }
 */
- (IBAction)ysSearchBtn:(id)sender {
    [CYHttpTool postWithURL:@"http://192.168.0.169:8088/phone/getDefaultRecordsByCityAndSex.htm" params:@{@"name": @"李学超", @"sex":@"0"} success:^(id json) {
        CYLog(@"json: %@", json);
    } failure:^(NSError *error) {
        CYLog(@"error: %@", error);
    }];
}
@end
